package com.cys.dm.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author blue_t
 * @date 2020-12-28 14:58
 */
public class AlipayConfig {
    //应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2021000116683623";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCg7Zj0YOoxD9vQwlDyGXtiKkaLwIXiow8G5IjQQqC+k7Xg+7oc/2kvOVco3tuJ5kcZzBgnIYa+JOdwO1l0YIOLQTbMUc8y95ZNN8yXlaHvTqF43t6BodLdUvo1ZrBWEYBl93eFZunyQLd0LinUg7okIg06H0BJs1zAMcfmNuqZYlt+8ancnh+RXSRzXgJ/6WgFGyaqmxvAHx2TwbxFPJ0dr6wNeyuFpMkeRVcdpkZYhqHS7H9oqmUDNo9ZpGrF47X6y8EXy53GzaAKALJpAIYk4snq5mR9RKq1eLuHMmaN7FTlIdu5zBuB5UvR53Sujjab2tHa5JQUcAoypouz8ABfAgMBAAECggEAAyP/6y0FBQYZNR7Fs6PZq5XFoK6WLlEeVvUY0m+qcW2yi/x9qlk1tU06LTsEL9HFq3Q3OHRIC+fueFtAKKxFhO814ZDrKUR5s3IWVRL/gQsYzaIT15XP5q/a4DXr1RIsXlERDRJwGGE481R/Tn1voYrklTDM8WNFuR5/lzeVJn8j+TpjZlc8VoUlajW0PnkKmx1PxPCBJniMzbk/92FFR8TuoLEAmb3FspgTpSofo0k+YmicrRbDsalIOT4GOXkveQPumnDJEFv6Da5ajDpsK4N6HzIXTi+h5N93jeuqnL0AzDCX95j4f8MUZFu35u9eZ6yHrOWjwsId/YGo8pXFgQKBgQDVjepFGno5EocTdwVvk1RunJCMPlRZmWkHYFbfru1OcGXDhY+EBUFR4z7/DY8U0PCAsgj4Y//FWJ/dl28z/+FC4w3d6Dq0Pwmsx0IwIfEK2hOI6f8n39NjYVHPMQzoe1ctxW3oI4WynmszF8MRx/v5auc0WDjn8kTD8n58tUSXHwKBgQDA6fNz0wa96Z9vyeH9knRVP7ndBleNtxWBoUrmEY8GaZfjzXLmzV/Ga07AskN3s9g/OLVGOjhgu2gUuyccDZVgCaZYZyG5dr52obypZEoMN92Juc4d74Tgv10UfYh2lfZSUanpinpuWKcZ1ySIzLJlagJbX5SF0u56KpwO8h2uwQKBgQC0XpXk4dUjiTOPTDLKJ1zjw9cOrMJfnwQnl8YoTT3fx20cNB2gOzQNbutRTulvgn3vpO+QpB1uWElGRtZEzDU9YjrfF3slrCyGwxFzR+en68MeG81Hp3OKd7M6VUp6vVpHrX4D2KTe1ZDjaYl35jo7UoCPJIiD14sfGRyeRhf1rwKBgQCsBTGwe2EMobEpFqUs3pZbmgqbW1dhJ/vGbtQB2XBm8Gufl4i45DNeFDvSOmNM7xKKNX/3Ul0JbLM/oS8bpcUoMRKiy7vXzFnEIS7BAYvB32Ltt8BjEzyyyBEw/0tbKxfNicJwXKoVkXnX4e9TCOye3+ugHNesiU1bpHkqHp13QQKBgQDRvjWzjkS2zhPR0w+ygYnonuM7LkYFAAohG9ApXc8CCuQSWhCmVKA2+fpFU633Jf3+FAJUq36SXIVZ6kXrbr3tZMIKi6RKHBhXcyKVCqbHNrocGVZJqEh6rlRXUOkYcmqwBdcdxdeLDkE4arYvHWewS5qUWrBazd99mKMTN3yVuw==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8Iw1+fez6no5GwavaID9ZQQw6b9gNx8kUSnAMOyv+VE0uNcvO/6xhA/7IlXgo9pGmuBcN7LcJGA0+Z+9+qdNUAYwZyfnHW9swXOKk6+wn5RU5K3G6PGwxu/TItbK/cRbWK0/WptiHvzzMo567Gzmq2G3S7bIkd0r0BU8WLcnSLw28wFFSL+BFlgEd3kDU8eCq0nzlBDL0njVBBNTfU2y8itmw4U0OwJA9yh83HumPinutDNMdNFmdWbqgT1YGzz0175JsiGseqvth5ALtcQj4YfNNuel95wZRQ4PO92oP5JylGP5hjcPWQ9h0pOXa24+IQG+kt9p0AOUIO/aqYx0kwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:8080/api/pay/alisuccess";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
